package com.core.web.struts2.taglib;

import javax.servlet.jsp.tagext.TagSupport;

/**
 * 通用基础 JSP 标签
 * 
 */
public class CommonTag extends TagSupport {

	protected String cssclass;
	protected String style;
	protected String disabled;
	protected String type;
	protected String name;
	protected String tabindex;
	protected String value;
	protected String maxlength;
	protected String minlength;
	protected String size;
	protected boolean readonly;
	protected String onclick;
	protected String ondblclick;
	protected String onmousedown;
	protected String onmouseup;
	protected String onmouseover;
	protected String onmousemove;
	protected String onmouseout;
	protected String onfocus;
	protected String onblur;
	protected String onkeypress;
	protected String onkeydown;
	protected String onkeyup;
	protected String onselect;
	protected String onchange;
	protected String datatype;
	protected String max;
	protected String min;
	protected String msg;
	protected String operator;
	protected String require;
	protected String to;
	protected String format;
	protected String regexp;

	public String getCommonHtml() {
		StringBuffer ret = new StringBuffer();

		ret.append(" name=\"").append(name).append("\"");

		if (id != null && !id.trim().equals("")) {
			ret.append(" id=\"").append(id).append("\"");
		} else {
			ret.append(" id=\"").append(name).append("\"");
		}
		if (this.cssclass != null && !this.cssclass.equals("")) {
			ret.append(" class=\"").append(this.cssclass).append("\"");
		}
		if (this.style != null && !this.style.equals("")) {
			ret.append(" style=\"").append(this.style).append("\"");
		}
		if (this.disabled != null && !this.disabled.equals("")) {
			ret.append(" disabled=\"").append(this.disabled).append("\"");
		}
		if (this.type != null && !this.type.equals("")) {
			ret.append(" type=\"").append(this.type).append("\"");
		}
		if (this.tabindex != null && !this.tabindex.equals("")) {
			ret.append(" tabindex=\"").append(this.tabindex).append("\"");
		}
		if (this.value != null && !this.value.equals("")) {
			ret.append(" value=\"").append(this.value).append("\"");
		}

		if (this.maxlength != null && !this.maxlength.equals("")) {
			ret.append(" maxlength=\"").append(this.maxlength).append("\"");
		}
		if (this.minlength != null && !this.min.equals("")) {
			ret.append(" minlength=\"").append(this.minlength).append("\"");
		}
		if (this.size != null && !this.size.equals("")) {
			ret.append(" size=\"").append(this.size).append("\"");
		}
		if (this.readonly) {
			ret.append(" readonly=\"true\"");
		}

		if (this.onclick != null && !this.onclick.equals("")) {
			ret.append(" onclick=\"").append(this.onclick).append("\"");
		}
		if (this.ondblclick != null && !this.ondblclick.equals("")) {
			ret.append(" ondblclick=\"").append(this.ondblclick).append("\"");
		}
		if (this.onmousedown != null && !this.onmousedown.equals("")) {
			ret.append(" onmousedown=\"").append(this.onmousedown).append("\"");
		}
		if (this.onmousemove != null && !this.onmousemove.equals("")) {
			ret.append(" onmousemove=\"").append(this.onmousemove).append("\"");
		}
		if (this.onmouseout != null && !this.onmouseout.equals("")) {
			ret.append(" onmouseout=\"").append(this.onmouseout).append("\"");
		}
		if (this.onmouseover != null && !this.onmouseover.equals("")) {
			ret.append(" onmouseover=\"").append(this.onmouseover).append("\"");
		}
		if (this.onmouseup != null && !this.onmouseup.equals("")) {
			ret.append(" onmouseup=\"").append(this.onmouseup).append("\"");
		}
		if (this.onfocus != null && !this.onfocus.equals("")) {
			ret.append(" onfocus=\"").append(this.onfocus).append("\"");
		}
		if (this.onblur != null && !this.onblur.equals("")) {
			ret.append(" onblur=\"").append(this.onblur).append("\"");
		}
		if (this.onkeydown != null && !this.onkeydown.equals("")) {
			ret.append(" onkeydown=\"").append(this.onkeydown).append("\"");
		}
		if (this.onkeypress != null && !this.onkeypress.equals("")) {
			ret.append(" onkeypress=\"").append(this.onkeypress).append("\"");
		}
		if (this.onkeyup != null && !this.onkeyup.equals("")) {
			ret.append(" onkeyup=\"").append(this.onkeyup).append("\"");
		}
		if (this.onchange != null && !this.onchange.equals("")) {
			ret.append(" onchange=\"").append(this.onchange).append("\"");
		}
		if (this.onselect != null && !this.onselect.equals("")) {
			ret.append(" onselect=\"").append(this.onselect).append("\"");
		}

		if (this.datatype != null && !this.datatype.equals("")) {
			ret.append(" datatype=\"").append(this.datatype).append("\"");
		}
		if (this.max != null && !this.max.equals("")) {
			ret.append(" max=\"").append(this.max).append("\"");
		}
		if (this.min != null && !this.min.equals("")) {
			ret.append(" min=\"").append(this.min).append("\"");
		}
		if (this.msg != null && !this.msg.equals("")) {
			ret.append(" msg=\"").append(this.msg).append("\"");
		}
		if (this.operator != null && !this.operator.equals("")) {
			ret.append(" operator=\"").append(this.operator).append("\"");
		}
		if (this.require != null && !this.require.equals("")) {
			ret.append(" require=\"").append(this.require).append("\"");
		}
		if (this.to != null && !this.to.equals("")) {
			ret.append(" to=\"").append(to).append("\"");
		}
		if (this.format != null && !this.format.equals("")) {
			ret.append(" format=\"").append(this.format).append("\"");
		}
		if (this.regexp != null && !this.regexp.equals("")) {
			ret.append(" regexp=\"").append(this.regexp).append("\"");
		}

		return ret.toString();
	}

	public String getCssclass() {
		return cssclass;
	}

	public void setCssclass(String cssclass) {
		this.cssclass = cssclass;
	}

	public String getStyle() {
		return style;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	public String getDisabled() {
		return disabled;
	}

	public void setDisabled(String disabled) {
		this.disabled = disabled;
	}

	public String getType() {
		return type;
	}

	public void setType(String type) {
		this.type = type;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getTabindex() {
		return tabindex;
	}

	public void setTabindex(String tabindex) {
		this.tabindex = tabindex;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getOnclick() {
		return onclick;
	}

	public void setOnclick(String onclick) {
		this.onclick = onclick;
	}

	public String getOndblclick() {
		return ondblclick;
	}

	public void setOndblclick(String ondblclick) {
		this.ondblclick = ondblclick;
	}

	public String getOnmousedown() {
		return onmousedown;
	}

	public void setOnmousedown(String onmousedown) {
		this.onmousedown = onmousedown;
	}

	public String getOnmouseup() {
		return onmouseup;
	}

	public void setOnmouseup(String onmouseup) {
		this.onmouseup = onmouseup;
	}

	public String getOnmouseover() {
		return onmouseover;
	}

	public void setOnmouseover(String onmouseover) {
		this.onmouseover = onmouseover;
	}

	public String getOnmousemove() {
		return onmousemove;
	}

	public void setOnmousemove(String onmousemove) {
		this.onmousemove = onmousemove;
	}

	public String getOnmouseout() {
		return onmouseout;
	}

	public void setOnmouseout(String onmouseout) {
		this.onmouseout = onmouseout;
	}

	public String getOnfocus() {
		return onfocus;
	}

	public void setOnfocus(String onfocus) {
		this.onfocus = onfocus;
	}

	public String getOnblur() {
		return onblur;
	}

	public void setOnblur(String onblur) {
		this.onblur = onblur;
	}

	public String getOnkeypress() {
		return onkeypress;
	}

	public void setOnkeypress(String onkeypress) {
		this.onkeypress = onkeypress;
	}

	public String getOnkeydown() {
		return onkeydown;
	}

	public void setOnkeydown(String onkeydown) {
		this.onkeydown = onkeydown;
	}

	public String getOnkeyup() {
		return onkeyup;
	}

	public void setOnkeyup(String onkeyup) {
		this.onkeyup = onkeyup;
	}

	public String getOnselect() {
		return onselect;
	}

	public void setOnselect(String onselect) {
		this.onselect = onselect;
	}

	public String getOnchange() {
		return onchange;
	}

	public void setOnchange(String onchange) {
		this.onchange = onchange;
	}

	public String getMax() {
		return max;
	}

	public void setMax(String max) {
		this.max = max;
	}

	public String getMin() {
		return min;
	}

	public void setMin(String min) {
		this.min = min;
	}

	public String getMsg() {
		return msg;
	}

	public void setMsg(String msg) {
		this.msg = msg;
	}

	public String getOperator() {
		return operator;
	}

	public void setOperator(String operator) {
		this.operator = operator;
	}

	public String getRequire() {
		return require;
	}

	public void setRequire(String require) {
		this.require = require;
	}

	public String getTo() {
		return to;
	}

	public void setTo(String to) {
		this.to = to;
	}

	public String getFormat() {
		return format;
	}

	public void setFormat(String format) {
		this.format = format;
	}

	public String getRegexp() {
		return regexp;
	}

	public void setRegexp(String regexp) {
		this.regexp = regexp;
	}

	public String getDatatype() {
		return datatype;
	}

	public void setDatatype(String datatype) {
		this.datatype = datatype;
	}

	public String getMaxlength() {
		return maxlength;
	}

	public void setMaxlength(String maxlength) {
		this.maxlength = maxlength;
	}

	public String getMinlength() {
		return minlength;
	}

	public void setMinlength(String minlength) {
		this.minlength = minlength;
	}

	public String getSize() {
		return size;
	}

	public void setSize(String size) {
		this.size = size;
	}

	public boolean isReadonly() {
		return readonly;
	}

	public void setReadonly(boolean readonly) {
		this.readonly = readonly;
	}
}
